package org.x.casemodule.enums;

public enum MaterialType {
    //case_material	material_type	"ID_CARD","EVIDENCE","CONTRACT","OTHER"	MaterialType

    ID_CARD("ID_CARD", "身份证"),
    EVIDENCE("EVIDENCE", "证据"),
    CONTRACT("CONTRACT", "合同"),
    OTHER("OTHER", "其他");

    private final String value;
    private final String desc;

    MaterialType(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static MaterialType getByValue(String value) {
        for (MaterialType type : MaterialType.values()) {
            if (type.getValue().equals(value)) {
                return type;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return value;
    }

    public static String getDescByValue(String value) {
        for (MaterialType type : MaterialType.values()) {
            if (type.getValue().equals(value)) {
                return type.name();
            }
        }
        return null;
    }

    public static String getDescByName(String name) {
        for (MaterialType type : MaterialType.values()) {
            if (type.name().equals(name)) {
                return type.getDesc();
            }
        }
        return null;
    }

    public static String getValueByName(String name) {
        for (MaterialType type : MaterialType.values()) {
            if (type.name().equals(name)) {
                return type.getValue();
            }
        }
        return null;
    }





}
